package com.lxyk.yygh.task.scheduled;

import com.lxyk.yygh.common.rabbit.constant.MqConst;
import com.lxyk.yygh.common.rabbit.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @ClassName ScheduledTask
 * @Description TODO
 * @Author FJQ
 * @Date 2023/4/8 15:22
 * @Version 1.0
 **/
@Component
@EnableScheduling   //开启定时任务操作
public class ScheduledTask {

    @Autowired
    private RabbitService rabbitService;

    /**
     * 每天8点执行方法  提醒就诊
     */
    // cron表达式，设置执行时间间隔
    // @Scheduled(cron = "0 0 1 * * ?")
    // 0 0 8 * * ?    实际用这个  每天8点执行
    @Scheduled(cron = "0/30 * * * * ?")  //测试用这个
    public void taskPatient() {
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK, MqConst.ROUTING_TASK_8, "");
    }
}